home *** CD-ROM | disk | FTP | other *** search
Text File | 1990-03-12 | 2.6 KB | 82 lines | [TEXT/MPS ] |
- ***********************************************************************
- ***
- *** Defer Cursor
- *** This program defers the cursor updating that normally happens
- *** during slot VBL time. Since the cursor updating can take as
- *** long as 900µSec, and holds off other slot interrupts, it is
- *** handy to be able to defer the updating to a more civilized time.
- *** This program replaces the normal jCrsrTask with a routine that
- *** installs the real jCrsrTask routine as a deferred task.
- ***
- *** 8/14/89 Re-wrote DeferCrsr.a to use the deferred task manager.
- ***
- *** Build commands:
- ***
- *** asm DeferCrsr.a -lo DeferCrsr.a.lst -l
- *** link DeferCrsr.a.o -o DeferCrsr
- ***
- ***********************************************************************
-
- STRING ASIS
- PRINT OFF
- INCLUDE 'Traps.a'
- INCLUDE 'SysEqu.a'
- PRINT ON
-
- ******************************** Entry *******************************
-
- Entry MAIN
-
- bra.s Entry2
-
- ****************************** MyDefTask *****************************
-
- TaskBegin
- MyDefTask
-
- DC.L 0 ;qLink (handled by OS)
- DC.W 0 ;qType (equ 7, find this value in MPW AIncludes)
- DC.W 0 ;dtFlags (reserved, don't mess with 'em)
- DC.L 0 ;dtAddr (pointer to actual routine to be performed)
- DC.L 0 ;dtParm (optional parameter, this example doesn't use it)
- DC.L 0 ;dtReserved (should be zero, DC.L 0 takes care of that)
-
- SysCrsrTask
- DC.L 0
-
- ***************************** MyjCrsrTask ****************************
-
- MyjCrsrTask
- movem.l a0/d0,-(sp)
- lea MyDefTask,a0 ;point to our deferred task element
- move.l SysCrsrTask,dtAddr(a0) ;set up pointer to routine
- move.w #dtQType,dtType(a0) ;set queue type
- _DTInstall ;install the task
- movem.l (sp)+,a0/d0
- rts
- TaskEnd
-
- ******************************** Entry2 ******************************
-
- TaskSize EQU TaskEnd-TaskBegin
-
- Entry2
- move.l #TaskSize,d0 ;TaskSize = Deferred task element, room for
- ; a pointer (to original jCrsrTask), and
- ;our jCrsrTask
- _NewPtr ,SYS,CLEAR ;make a block in the system heap
- bne.s Abort ;no room at the Inn, head for the manger
- move.l a0,a2 ;got a good pointer, keep a copy
- move.l a0,a1 ;a0 = source, a1 = destination for BlockMove
- lea MyDEFTask,a0 ;copy the task, etc. into the system heap
- move.w #TaskSize,d0
- _BlockMove
-
- lea dtQElSize(a2),a0 ;move original jCrsrTask pointer into our
- move.l jCrsrTask,(a0) ; pointer holder
- lea dtQElSize+4(a2),a0 ;replace jCrsrTask pointer with a pointer
- move.l a0,jCrsrTask ; to our jCrsrTask
-
- abort rts ;all's well that ends…
-
- END